cmake_minimum_required(VERSION 2.8)

# CONSIDER CHANGING THIS FLAG IF YOU HAVE TROUBLE COMPILING
# options: << -D__CONFIG_0__ >> << -D__CONFIG_1__ >>
add_definitions(-D__CONFIG_0__)

# Maybe move more specifically towards setting compiler directives for each library individually...
# add_definitions(-DOPENCV_VERSION=${OpenCV_VERSION})

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp")

include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)
rosbuild_init()
rosbuild_genmsg()

#add dynamic reconfigure api
rosbuild_find_ros_package(dynamic_reconfigure)
include(${dynamic_reconfigure_PACKAGE_PATH}/cmake/cfgbuild.cmake)
gencfg()

set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)	

find_package(OpenCV REQUIRED)
IF(NOT OpenCV_FOUND)
	# Here you can try and help it to find OpenCV if required...
    set(OpenCV_DIR /opt/ros/cturtle/stacks/vision_opencv/opencv2/opencv/share/opencv/)
    find_package(OpenCV)
ENDIF(NOT OpenCV_FOUND)

SUBDIRS(
	# PUBLIC
	nodes/streamer 			# streams from a thermal camera
	nodes/radiometry   		# operates a blackbody and selectively records radiometric calibration data
	nodes/calibrator   		# intrinsic and extrinsic calibration of cameras
	nodes/depth				# returns a depth map from two unsynchronized thermal cameras
	nodes/extractor			# extracts images and other data from a "mapping" bagfile
	nodes/flow 				# performs sparse optical flow from a video stream
	
	# PUBLIC - REQUIRES EXTERNAL SBA LIBRARY
	nodes/videoslam			# performs monocular SLAM from optical flow stream with external support
	nodes/monoslam 			# performs monocular SLAM from optical flow stream
	
	# PROTECTED IP
	nodes/mapper   			# performs 3D thermal mapping using range and thermal-video data
	#nodes/arbitration  		# selects most reliable modality for challenging localization tasks
	nodes/nucManager   		# Uses pose information to dictate to streamer when it should perform NUCs
)
